--------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\matt\working_papers\bjps_replication\first_draft\replication\volatility.log
  log type:  text
 opened on:  30 Apr 2015, 19:21:08

. #delimit ;
delimiter now ;
. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:      volatility.do                                   *;
. *       Date:           December 15, 2014                               *;
. *       Author:         MRG/CC                                          *;
. *       Purpose:        Take bjps_powell_tucker_dataset.dta and         *;
. *                       replicate results in Table 1.                   *;
. *           Input File:     bjps_powell_tucker_dataset.dta                  *;
. *       Output File:    volatility.log                                  *;
. *       Data Output:    bjps_powell_tucker_dataset2.dta                 *;
.              *       Previous file:  bjps_powell_tucker_dataset.dta                  *;
. *       Machine:        laptop                                                      *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Load data. Data set downloaded from www.eleanorneffpowell.com   *;
. *       on December 15, 2014.                                           *;
. *     ****************************************************************  *;
. use "C:\matt\working_papers\bjps_replication\first_draft\replication\bjps_powell_tucker_dataset.dta", clear;
(Written by R.              )

. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Verify Powell and Tucker results.  These are Columns 1 and 2    *;
. *       in Table 1.  These results correspond to Powell and Tucker's    *;
. *       preferred model (Model 4) in their Tables 3 and 5.              *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Limit data to their sample of 89 elections.                     *;
. *     ****************************************************************  *;
. keep if EEIndicator == 1;
(95 observations deleted)

.  *     ****************************************************************  *;
. *       Create indicator for all countries except Bosnia-Herzegovina    *;
. *     ****************************************************************  *;
. gen id = 1;

. replace id = 0 if Country == "Bosnia-Herzegovina";
(3 real changes made)

. *     ****************************************************************  *;
. *       Powell helped us verify the results in Models 4 in Tables 3 and *;
. *       5 (March 26, 2014, via email).  Note that it is necessary to    *;
. *       include mis_weighted_mag to verify the results exactly. As      *;
. *       explained in footnote 34 of their article, they do not include  *;
. *       the coefficient for this variable in their tables.  To match    *;
. *       what they did, we follow their specification and do not report  *;
. *       the coefficient on this variable either.                        *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Results in column 1: Electoral volatility (Type B volatility)   *;
. *     ****************************************************************  *;
.  reg TypeBVol GDPChange1989 GDPChangeE1E2 Enp1 lg_weighted_mag presys mixsys pr 
>             EthFrac Time Time2 mis_weighted_mag, cluster(Country);

Linear regression                                      Number of obs =      89
                                                       F( 10,    20) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.1164
                                                       Root MSE      =  8.3583

                                   (Std. Err. adjusted for 21 clusters in Country)
----------------------------------------------------------------------------------
                 |               Robust
        TypeBVol |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   GDPChange1989 |   .6390475   .6931777     0.92   0.368    -.8068958    2.084991
   GDPChangeE1E2 |  -2.059463   5.219468    -0.39   0.697    -12.94708    8.828156
            Enp1 |   .4461609   .3131475     1.42   0.170    -.2070533    1.099375
 lg_weighted_mag |  -.7836013   .8872519    -0.88   0.388    -2.634376    1.067174
          presys |  -4.631132   4.126399    -1.12   0.275    -13.23865    3.976386
          mixsys |  -2.788081   2.211099    -1.26   0.222    -7.400352    1.824191
              pr |   .8272548   2.228449     0.37   0.714    -3.821208    5.475717
         EthFrac |  -6.163173    6.39737    -0.96   0.347    -19.50785    7.181506
            Time |   .8483403   .8074896     1.05   0.306    -.8360536    2.532734
           Time2 |   -.031076   .0420872    -0.74   0.469    -.1188684    .0567163
mis_weighted_mag |   3.944475   2.484051     1.59   0.128    -1.237165    9.126114
           _cons |   13.05863   5.318277     2.46   0.023     1.964895    24.15236
----------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Results in column 2: Replacement volatility (Type A volatility) *;
. *     ****************************************************************  *;
. reg TypeAVol GDPChange1989 GDPChangeE1E2 Enp1 lg_weighted_mag presys mixsys pr 
>             EthFrac Time Time2 mis_weighted_mag, cluster(Country);

Linear regression                                      Number of obs =      89
                                                       F( 10,    20) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.1391
                                                       Root MSE      =  19.748

                                   (Std. Err. adjusted for 21 clusters in Country)
----------------------------------------------------------------------------------
                 |               Robust
        TypeAVol |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   GDPChange1989 |  -4.623273   1.326468    -3.49   0.002    -7.390237   -1.856309
   GDPChangeE1E2 |   9.018828   10.12812     0.89   0.384    -12.10806    30.14571
            Enp1 |  -.3457171   .5330995    -0.65   0.524    -1.457743    .7663089
 lg_weighted_mag |   .6378143   2.930929     0.22   0.830    -5.475996    6.751624
          presys |    6.78367   9.434638     0.72   0.480    -12.89664    26.46398
          mixsys |   4.254561   5.896578     0.72   0.479    -8.045484    16.55461
              pr |    .077218   6.003616     0.01   0.990     -12.4461    12.60054
         EthFrac |  -2.676918   18.97838    -0.14   0.889    -42.26512    36.91128
            Time |  -2.632837   2.153325    -1.22   0.236    -7.124594     1.85892
           Time2 |   .0701217   .1005823     0.70   0.494    -.1396893    .2799327
mis_weighted_mag |  -10.19308   5.269976    -1.93   0.067    -21.18606    .7998974
           _cons |   41.94103   13.32909     3.15   0.005     14.13704    69.74501
----------------------------------------------------------------------------------

.             *     ****************************************************************  *;
. *       Verification complete.                                          *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Drop observations from Bosnia-Herzegovina. These are Columns 3  *;
. *       and 4 in Table 1.                                               *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Results in column 3: Electoral volatility (Type B volatility)   *;
. *     ****************************************************************  *;
. reg TypeBVol GDPChange1989 GDPChangeE1E2 Enp1 lg_weighted_mag presys mixsys pr 
>             EthFrac Time Time2 mis_weighted_mag if id == 1, cluster(Country);

Linear regression                                      Number of obs =      86
                                                       F( 10,    19) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.1137
                                                       Root MSE      =  8.5189

                                   (Std. Err. adjusted for 20 clusters in Country)
----------------------------------------------------------------------------------
                 |               Robust
        TypeBVol |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   GDPChange1989 |   .1164258   3.205861     0.04   0.971    -6.593519    6.826371
   GDPChangeE1E2 |  -1.891834    5.89766    -0.32   0.752    -14.23578    10.45211
            Enp1 |   .4516068   .3161794     1.43   0.169    -.2101642    1.113378
 lg_weighted_mag |  -.7890028   .8815689    -0.89   0.382    -2.634148    1.056142
          presys |  -4.847488   4.605852    -1.05   0.306    -14.48765    4.792672
          mixsys |  -2.813008    2.28554    -1.23   0.233      -7.5967    1.970683
              pr |   .8519567   2.265278     0.38   0.711    -3.889325    5.593239
         EthFrac |   -6.71553   6.783597    -0.99   0.335    -20.91376    7.482701
            Time |   .8282156   .8627614     0.96   0.349    -.9775648    2.633996
           Time2 |  -.0294495    .044422    -0.66   0.515    -.1224258    .0635269
mis_weighted_mag |   3.900427   2.529858     1.54   0.140    -1.394627    9.195481
           _cons |   13.58628   5.114655     2.66   0.016     2.881188    24.29138
----------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Results in column 4: Replacement volatility (Type A volatility) *;
. *     ****************************************************************  *;
. reg TypeAVol GDPChange1989 GDPChangeE1E2 Enp1 lg_weighted_mag presys mixsys pr 
>             EthFrac Time Time2 mis_weighted_mag if id == 1, cluster(Country);

Linear regression                                      Number of obs =      86
                                                       F( 10,    19) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.1194
                                                       Root MSE      =  19.827

                                   (Std. Err. adjusted for 20 clusters in Country)
----------------------------------------------------------------------------------
                 |               Robust
        TypeAVol |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   GDPChange1989 |  -6.065884   7.177514    -0.85   0.409    -21.08859    8.956826
   GDPChangeE1E2 |   6.676998   10.70446     0.62   0.540    -15.72769    29.08169
            Enp1 |  -.2644927   .5582499    -0.47   0.641    -1.432923    .9039378
 lg_weighted_mag |   .6034554   2.892626     0.21   0.837    -5.450879     6.65779
          presys |   5.531797   10.24059     0.54   0.595    -15.90201    26.96561
          mixsys |   4.017449   5.884755     0.68   0.503    -8.299484    16.33438
              pr |  -.1457507   5.942806    -0.02   0.981    -12.58419    12.29269
         EthFrac |  -5.297656   22.93949    -0.23   0.820    -53.31056    42.71525
            Time |  -1.988688   2.117445    -0.94   0.359    -6.420552    2.443175
           Time2 |   .0447477     .09742     0.46   0.651    -.1591548    .2486502
mis_weighted_mag |  -9.422157   5.101868    -1.85   0.080    -20.10049    1.256175
           _cons |   43.66067   14.05686     3.11   0.006     14.23931    73.08202
----------------------------------------------------------------------------------

.             *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Correct the three observations for Bosnia-Herzegovina. These    *;
. *       are Columns 5 and 6 in Table 1.                                 *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Note that the codebook indicates that the original              *;
. *       GDPChange1989 variable data comes from Pop-Eleches 2010.  The   *;
. *       actual article indicates that the data comes from Pacek,        *;
. *       Pop-Eleches, and Tucker 2009.                                   *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
.  *       Create new GDPChange1989_corrected variable with the correct    *;
. *       values for Bosnia-Herzegovina. Correct data for this variable   *;
. *       come from the EBRD's Transition Report 2012, p. 103.  See       *;
. *     www.ebrd.com/downloads/research/transition/assessments/bosnia.pdf *;
. *     ****************************************************************  *;
. gen GDPChange1989_corrected=GDPChange1989;

. replace GDPChange1989_corrected = 0.55882353 if Country == "Bosnia-Herzegovina" & Year2==2000;
(1 real change made)

. replace GDPChange1989_corrected = 0.60784314 if Country == "Bosnia-Herzegovina" & Year2==2002;
(1 real change made)

. replace GDPChange1989_corrected = 0.74019608 if Country == "Bosnia-Herzegovina" & Year2==2006;
(1 real change made)

. list Country Year2 GDPChange1989 GDPChange1989_corrected if Country == "Bosnia-Herzegovina";

     +--------------------------------------------------+
     |            Country   Year2   GDP~1989   GDPCha~d |
     |--------------------------------------------------|
 10. | Bosnia-Herzegovina    2000   4.921722   .5588235 |
 11. | Bosnia-Herzegovina    2002   5.410607   .6078432 |
 12. | Bosnia-Herzegovina    2006   6.657459   .7401961 |
     +--------------------------------------------------+

. *     ****************************************************************  *;
. *       Results in column 5: Electoral volatility (Type B volatility)   *;
. *     ****************************************************************  *;
.  reg TypeBVol GDPChange1989_corrected GDPChangeE1E2 Enp1 lg_weighted_mag presys mixsys pr 
>             EthFrac Time Time2 mis_weighted_mag, cluster(Country);

Linear regression                                      Number of obs =      89
                                                       F( 10,    20) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.1123
                                                       Root MSE      =  8.3774

                                          (Std. Err. adjusted for 21 clusters in Country)
-----------------------------------------------------------------------------------------
                        |               Robust
               TypeBVol |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
GDPChange1989_corrected |    .004056   3.233154     0.00   0.999    -6.740186    6.748298
          GDPChangeE1E2 |  -1.076221   5.229484    -0.21   0.839    -11.98473    9.832291
                   Enp1 |   .4705121   .3260314     1.44   0.164    -.2095774    1.150602
        lg_weighted_mag |  -.8243895   .8856223    -0.93   0.363    -2.671765    1.022986
                 presys |  -4.927789   4.622586    -1.07   0.299    -14.57033    4.714757
                 mixsys |  -2.596471   2.265718    -1.15   0.265    -7.322677    2.129735
                     pr |   .9870268   2.222862     0.44   0.662    -3.649783    5.623836
                EthFrac |   -5.71324   6.771689    -0.84   0.409    -19.83874    8.412256
                   Time |   .7317413   .7971492     0.92   0.370    -.9310828    2.394565
                  Time2 |  -.0261021   .0425186    -0.61   0.546    -.1147943    .0625901
       mis_weighted_mag |   3.325791   2.121533     1.57   0.133     -1.09965    7.751232
                  _cons |   12.88495   5.033683     2.56   0.019     2.384875    23.38503
-----------------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Results in column 6: Replacement volatility (Type A volatility) *;
. *     ****************************************************************  *;
. reg TypeAVol GDPChange1989_corrected GDPChangeE1E2 Enp1 lg_weighted_mag presys mixsys pr 
>             EthFrac Time Time2 mis_weighted_mag, cluster(Country);

Linear regression                                      Number of obs =      89
                                                       F( 10,    20) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.1085
                                                       Root MSE      =  20.096

                                          (Std. Err. adjusted for 21 clusters in Country)
-----------------------------------------------------------------------------------------
                        |               Robust
               TypeAVol |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
GDPChange1989_corrected |  -6.002082   6.609368    -0.91   0.375    -19.78898    7.784819
          GDPChangeE1E2 |   4.575911   10.06374     0.45   0.654    -16.41668     25.5685
                   Enp1 |  -.4616035   .5463071    -0.84   0.408     -1.60118    .6779731
        lg_weighted_mag |   .8195839   2.872327     0.29   0.778    -5.171985    6.811153
                 presys |   6.659308   10.29583     0.65   0.525    -14.81742    28.13604
                 mixsys |   2.620682   5.886881     0.45   0.661    -9.659137     14.9005
                     pr |  -.7391515   5.948313    -0.12   0.902    -13.14711    11.66881
                EthFrac |  -11.82813   22.93127    -0.52   0.612    -59.66192    36.00565
                   Time |  -1.958832   1.976091    -0.99   0.333    -6.080886    2.163222
                  Time2 |   .0491557   .0932285     0.53   0.604    -.1453156     .243627
       mis_weighted_mag |   -6.30029   4.936375    -1.28   0.216    -16.59739    3.996808
                  _cons |   48.19123   14.50943     3.32   0.003     17.92508    78.45737
-----------------------------------------------------------------------------------------

.             *     ****************************************************************  *;
. *       Save the dataset with the corrected values for                  *;
. *       Bosnia-Herzegovina.                                             *;
. *     ****************************************************************  *;
. save "C:\matt\working_papers\bjps_replication\first_draft\replication\bjps_powell_tucker_dataset2.dta", replace;
file C:\matt\working_papers\bjps_replication\first_draft\replication\bjps_powell_tucker_dataset2.dta saved

. *     ****************************************************************  *;
. *       We report some other results at various points in the paper.    *;
. *     ****************************************************************  *;
. sum GDPChange1989;

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
GDPChan~1989 |        89    1.137384    .9432279   .2234464   6.657459

. sum GDPChange1989 if Country == "Bosnia-Herzegovina";

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
GDPChan~1989 |         3    5.663263    .8950262   4.921722   6.657459

. sum GDPChange1989 if Country != "Bosnia-Herzegovina";

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
GDPChan~1989 |        86    .9795043    .3925067   .2234464   2.036082

. gsort -GDPChange1989;

. list Country year GDPChange1989 in 1/4;

     +------------------------------------------+
     |            Country   yeardiff   GDP~1989 |
     |------------------------------------------|
  1. | Bosnia-Herzegovina          4   6.657459 |
  2. | Bosnia-Herzegovina          2   5.410607 |
  3. | Bosnia-Herzegovina          2   4.921722 |
  4. |             Poland          2   2.036082 |
     +------------------------------------------+

. *     ****************************************************************  *;
. *       Replication complete                                            *;
. *     ****************************************************************  *;
. log close;
      name:  <unnamed>
       log:  C:\matt\working_papers\bjps_replication\first_draft\replication\volatility.log
  log type:  text
 closed on:  30 Apr 2015, 19:21:08
--------------------------------------------------------------------------------------------------------------------------------------
